home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue53 / construc / DRBOB42X.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-12-06  |  1.4 KB  |  74 lines

  1. unit DrBob42X;
  2. interface
  3. uses
  4.   Classes, HTTPApp, WebComp, MidItems;
  5.  
  6. type
  7.   TWebCheckbox = class(TWebTextInput)
  8.   protected
  9.     function ControlContent(Options: TWebContentOptions): string; override;
  10.   published
  11.     property DisplayWidth;
  12.     property ReadOnly;
  13.     property Caption;
  14.     property CaptionAttributes;
  15.     property CaptionPosition;
  16.     property TabIndex;
  17.     property Style;
  18.     property Custom;
  19.     property StyleRule;
  20.   end;
  21.  
  22.   TQueryCheckbox = class(TWebCheckbox, IQueryField)
  23.   private
  24.     FText: string;
  25.   protected
  26.     function GetText: string;
  27.     procedure SetText(const Value: string);
  28.   public
  29.     class function IsQueryField: Boolean; override;
  30.   end;
  31.  
  32. procedure Register;
  33.  
  34. implementation
  35. uses
  36.   SysUtils;
  37.  
  38. { TWebCheckbox }
  39.  
  40. function TWebCheckbox.ControlContent(Options: TWebContentOptions): string;
  41. var
  42.   Attrs: string;
  43. begin
  44.   AddAttributes(Attrs);
  45.   Result := Format('<INPUT TYPE=CHECKBOX %0:s>', [Attrs]);
  46. end;
  47.  
  48. { TQueryCheckbox }
  49.  
  50. class function TQueryCheckbox.IsQueryField: Boolean;
  51. begin
  52.   Result := True;
  53. end;
  54.  
  55. function TQueryCheckbox.GetText: string;
  56. begin
  57.   Result := FText;
  58. end;
  59.  
  60. procedure TQueryCheckbox.SetText(const Value: string);
  61. begin
  62.   FText := Value;
  63. end;
  64.  
  65. { Register procedure }
  66.  
  67. procedure Register;
  68. begin
  69.   RegisterWebComponents([TWebCheckBox,TQueryCheckbox]);
  70. end;
  71.  
  72. end.
  73.  
  74.